/*
 * @lc app=leetcode.cn id=929 lang=javascript
 *
 * [929] 独特的电子邮件地址
 */

// @lc code=start
/**
 * @param {string[]} emails
 * @return {number}
 */
var numUniqueEmails = function (emails) {
  const real = emails
    .map(email => email.split('@'))
    .map(([name, domain]) => name.replace(/\+.*/, '').replace(/\./g, '') + '@' + domain);
  return new Set(real).size;
};
// @lc code=end
